<template>
  <view class="normal-login-container">

    <view class="item-wrap" style="margin-bottom: 0">

      <view class="lineBottom10">
        <uni-section title="基础信息" type="line"/>
      </view>

      <view class="flex-col flex1">
        <view class="text-line" v-if="isList">
          <text class="text-name">车辆总台数:</text>
          <text class="text-value flex1">{{ param.carList.length|filterNull }}台</text>
          <text class="text-value right20 warn-text">合计费用: {{param.totalAmount|filterNull}}</text>
        </view>

        <view class="text-line">
          <text class="text-name">客户名称:</text>
          <text class="text-value">{{ param.customerName|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">产品类型:</text>
          <dict-tag
            :options="dict.type.quota_rent_type"
            :value="param.contractType"/>
        </view>
        <view class="text-line">
          <text class="text-name">合同禀议编号:</text>
          <text class="text-value">{{ param.contractReportNumber|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">合同开始日期:</text>
          <text class="text-value">{{ param.contractStartTime|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">合同结束日期:</text>
          <text class="text-value">{{ param.contractEndTime|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">采购禀议编号:</text>
          <text class="text-value">{{ param.procurementReportNumber|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">车辆产权公司:</text>
          <text class="text-value">{{ param.propertyRightName|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">车辆归属公司:</text>
          <text class="text-value">{{ param.ascription|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">车辆运营城市:</text>
          <text class="text-value">{{ param.operationsName|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">车辆大区:</text>
          <text class="text-value">{{ param.region|filterNull }}</text>
        </view>
        <view v-if="!isList">
          <view class="text-line">
            <text class="text-name">品牌车系车型:</text>
            <text class="text-value">{{ param.brandName|filterNull }}/{{
                param.seriesName|filterNull
              }}/{{ param.modelName|filterNull }}
            </text>
          </view>
          <view class="text-line">
            <text class="text-name">车架号:</text>
            <text class="text-value">{{ param.vinNo|filterNull }}</text>
          </view>
          <view class="text-line">
            <text class="text-name">车牌号:</text>
            <text class="text-value">{{ param.carNo|filterNull }}</text>
          </view>
		  <view class="text-line">
		    <text class="text-name">车辆状态:</text>
		    <dict-tag
		      :options="dict.type.car_business_type"
		      :value="param.businessType"/>
		  </view>
        </view>
        <view class="text-line">
          <text class="text-name">处理人:</text>
          <text class="text-value">{{ param.processedByName|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">处理时间:</text>
          <text class="text-value">{{ param.processedByTime|filterNull }}</text>
        </view>
        <view class="text-line">
          <text class="text-name">工单创建时间:</text>
          <text class="text-value">{{ param.createTime|filterNull }}</text>
        </view>

      </view>

      <template v-if="isList">
        <view class="car-wrap" v-for="(item, index) in param.carList" :key="index">
          <view class="text-line ">
            <text class="text-name flex1">{{item.vinNo}}</text>
            <text class="text-value">{{ item.carNo|filterNull }}</text>
          </view>
          <view class="text-line">
            <text class="text-name brandname">{{ item.brandName|filterNull }}/{{
                item.seriesName|filterNull
              }}/{{ item.modelName|filterNull }}</text>
<!--            <text class="text-value">{{ item.brandName|filterNull }}/{{-->
<!--                item.seriesName|filterNull-->
<!--              }}/{{ item.modelName|filterNull }}</text>-->
          </view>
      </view>
      </template>

    </view>

  </view>
</template>

<script>

import UniSection from "@/uni_modules/uni-section/components/uni-section/uni-section.vue";

export default {
  components: {UniSection},
  dicts: ["quota_rent_type", "car_business_type"],
  props: {
    value: {
      type: Object,
      default() {
        return () => {
        }
      }
    }
  },
  computed:{
    isList(){
      let flag = false;
      if(this.value.carList !== undefined && this.value.carList !== null && this.value.carList.length>0){
        flag = true;
      }

      if(flag){
        // this.value = {...this.value, ...this.value.carList[0], totalAmount:this.value.totalAmount}
		this.$set(this, 'param', {...this.value, ...this.value.carList[0], totalAmount:this.value.totalAmount})
      }else{
		this.$set(this, 'param', {...this.value})
	  }
	  // this.value.contractType = 2
	  console.log('this.param', this.param);
	  console.log('this.contr', this.param.contractType);
	  // setTimeout(()=>{
		 //  this.$forceUpdate()
	  // }, 1000)

      return flag;
    }
  },
  data() {
    return {
		param:{}
	}
  },

  methods: {}
}
</script>

<style lang="scss" scoped>
.car-wrap{
  display: flex;
  flex-direction: column;
  padding: 20rpx 20rpx 20rpx 0;
  border: 1px solid #dadada;
  margin: 10rpx 20rpx;
  border-radius: 8rpx;

}
.brandname{
	white-space: normal;
	word-break: break-all;
}

</style>
